/**
 * 0349
 *
 * @Author : Ruoyu Wang
 * @DateTime : 2024/8/12 22:09
 */

#include <iostream>
#include <vector>
#include "unordered_set"

using namespace std;

class Solution {
public:
    vector<int> intersection(vector<int> &nums1, vector<int> &nums2) {
        unordered_set<int> set;
        vector<int> res;
        for (auto &x: nums1) {
            set.insert(x);
        }
        for (auto &x: nums2) {
            if (set.count(x)) {
                res.push_back(x);
                set.erase(x);
            }
        }
        return res;
    }
};

int main() {

    return 0;
}